﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;

namespace DAL
{
    public class test
    {
       static string conStr = ConfigurationManager.ConnectionStrings["conStr"].ConnectionString;

       //string sql = "select * from user ";
       public static DataTable ExecuteDataTable(string sql)
       {
           using (SqlConnection conn = new SqlConnection(conStr))
           {
               conn.Open();
               using(SqlCommand cmd = conn.CreateCommand() )
               {
                   cmd.CommandText = sql;
                   SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                   DataSet ds = new DataSet();
                   adapter.Fill(ds);
                   return ds.Tables[0];


               }

           }
       }

    }
}
